package com.ke.jun.bg.petpackmvvm.base.fragmnet

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import com.ke.jun.bg.petpackmvvm.base.viewmodel.BaseViewModel
/**
 * 描述　: ViewModelFragment基类，自动把ViewModel注入Fragment和Databind注入进来了
 * 需要使用Databind的清继承它
 */
abstract  class BaseVmDbFragment<VM:BaseViewModel,DB:ViewDataBinding>:BaseVmFragment<VM>() {
    //该类绑定的ViewDataBinding
    lateinit var mBinding: DB
    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        mBinding = DataBindingUtil.inflate(inflater, layoutId(), container, false)
        mBinding.lifecycleOwner = this
        return mBinding.root
    }
}